package edu.gdkm.interfacedemo;

public class TVController implements RemoteController{
    boolean power;
    int volumn;
    int volumnTemp;
    TVController(int volumn){
        this.power = Controller.POWER_ON;
        this.volumn = volumn;
        this.volumnTemp = volumn;
    }

    @Override
    public void powerOnOff() {
        this.power = !this.power;
        if(this.power){
            this.volumn = this.volumnTemp;
        }else{
            this.volumnTemp = this.volumn;
            this.volumn = 0;
        }
    }

    @Override
    public void volumnUp(int increment) {
        this.volumn += increment;
    }

    @Override
    public void volumnDown(int increment) {
        this.volumn -= increment;
    }

    @Override
    public void outPut() {
        System.out.println("TV is "+(this.power?"on":"off")+" and volumn is "+this.volumn);
    }
}
